import com.fxb.dubbo.quickstart.api.IProviderService;
import com.fxb.dubbo.quickstart.service.impl.ProviderServiceImpl;
import java.util.concurrent.CountDownLatch;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;

/**
 * 服务启动
 *
 * @author fangjiaxiaobai
 * @date 2021-10-13 16:01
 */
public class ProviderApplication {

    private static final String zookeeperHost = "127.0.0.1";

    public static void main(String[] args) throws InterruptedException {
        ServiceConfig<IProviderService> service = new ServiceConfig<>();
        service.setApplication(new ApplicationConfig("first-dubbo-provider"));
        service.setRegistry(new RegistryConfig("zookeeper://" + zookeeperHost + ":2181"));
        service.setInterface(IProviderService.class);
        service.setRef(new ProviderServiceImpl());
        service.export();

        System.out.println("dubbo service started");
        new CountDownLatch(1).await();
    }
}
